<template>
  <div>
    <el-form-item label="类型">
      <el-select v-model="localData.selectType" clearable>
        <el-option label="单选" value="single" />
        <el-option label="多选" value="multiple" />
      </el-select>
    </el-form-item>
    <el-form-item label="接口参数">
      <anvil-dynamic v-model="localData.apiParams" :children="option.children" />
    </el-form-item>
  </div>
</template>

<script>

export default {
  name: 'SelectStoreConfig',
  props: {
    data: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      localData: {},
      option: {
        children: {
          align: 'center',
          headerAlign: 'center',
          column: [
            {
              type: 'input',
              prop: 'key',
              label: 'key'
            },
            {
              type: 'input',
              prop: 'value',
              label: 'value'
            }
          ]
        },
        dynamicType: 'table',
        dynamicModel: 'common'
      }
    }
  },
  watch: {
    data: {
      handler(newVal) {
        if (newVal) {
          this.localData = newVal
        }
      },
      deep: true,
      immediate: true
    },
    localData: {
      handler(newVal) {
        this.$emit('update:data', newVal)
      },
      deep: true
    }
  }
}
</script>

<style scoped></style>
